<template>
  <div class="user-avatar-dropdown">
    
    <Badge>
      <Avatar src="/logo.gif" />
    </Badge>
    <Tooltip content="退出登录" placement="bottom">
      <Icon @click="handleClick" :size="22" type="ios-log-out" class="logout"></Icon>
    </Tooltip>
  </div>
</template>

<script>
import "./user.less";
import { mapActions, mapMutations } from "vuex";
export default {
  methods: {
    ...mapActions(["handleLogOut"]),
    logout() {
      this.handleLogOut().then(() => {
        this.$store.commit("setTagNavList",[])
        this.$router.push({
          name: "login"
        });
      });
    },
    handleClick() {
      this.logout();
    }
  }
};
</script>
